export interface ResponseData {
    status: number
    success?: {
        message: string
    }
    error?: {
        message: string
        code: number
    }
}

export type add_record_list = {
    index: number
    material_id: number
    whole_piece: string
    scatt_piece: string
    weight: string
    remark: string
}

// 物料分组 增删改查
type use_data_mode = 'create' | 'delete' | 'update' | 'read'
type record_json_type = {
    create: {
        in_out_list: add_record_list[]
        handle_id: number
        actual_date: string
        trend: boolean
        store_type: boolean
    }
    delete: {
        id: number
    }
    update: {
        record_id: number
        whole_piece: number
        scatt_piece: number
        weight: number
        remark: string
        trend: boolean
    }
    read: {
        record_id: number
    }
}
type record_json_type1 = {
    create: { index: number, msg: string }
    delete: {}
    update: {}
    read: {}
}

// 物料分组增删改查 请求参数
export interface RecordCRUD<T extends use_data_mode = use_data_mode> {
    param: record_json_type[T]
    mode: T
}


// 物料分组增删改查 返回参数
export interface RecordCRUDResp<T extends use_data_mode = use_data_mode> extends ResponseData {
    data: record_json_type1[T]
}


export type RecordList = {
    id: number
    trend: boolean
    whole_piece: number
    scatt_piece: number
    weight: number
    remark: string
    handle_name: string
    operator_name: string
    material_code: string
    material_name: string
    material_model: string
    operate_date_: string
    actual_date_: string
    set_piece: number
    store_type: boolean
}


// 物料 模糊搜索 请求参数
export interface RecordFuzzySearch{
    material_group_id: number | null
    material_id: number | null
    handle_id: number | null
    handle_group_id: number | null
    operate_date: [string, string] | null
    actual_date: [string, string] | null
    trend: 'in' | 'out' | 'all'
    start: number
    stop: number
    store_type: boolean
}


// 物料分组 模糊搜索 返回参数
export interface RecordFuzzySearchResp extends ResponseData {
    data: {
        result: RecordList[],
        total: number,
    }
}

